package com.iot08.common.entity.app.sms;

import com.aliyun.dysmsapi20170525.models.SendSmsResponseBody;

import java.util.Optional;

/**
 * @description:
 * @author: chenwenjie 
 * @date: 2023/6/29 10:24
 * @param: 
 * @return: 
 **/
public class SendSmsResponseWrapper {
    private SendSmsResponseBody responseBody;

    public SendSmsResponseWrapper() {}

    public SendSmsResponseWrapper(SendSmsResponseBody responseBody) {
        this.responseBody = responseBody;
    }

    public boolean isSuccess() {
        return Optional.ofNullable(responseBody.getCode())
                .filter("OK"::equals)
                .isPresent();
    }

    public boolean isFail() {
        return !isSuccess();
    }

    public String getMessage() {
        return responseBody.getMessage();
    }

}
